#include <iostream>
#include <sstream>
#include <cstdio>
#include <cstdlib>
using namespace std;
typedef long long LONG;
void Extended_Euclid(LONG& A, LONG& B, LONG& X, LONG& Y) {
	LONG Px, Py, Q, R, U, V;
	X = Py = 0, Px = Y = 1;
	while(B != 0) {
		Q = A/B;
		
		R = A%B;
		A = B; B = R;

		U = Px-Q*X, V = Py-Q*Y;
		Px = X, Py = Y;
		X = U, Y = V;
	}
	X = Px;
	Y = Py;
}

/* main
 *  * */
int main() {
	std::ios_base::sync_with_stdio (true);
	LONG A, B, X, Y;
	cin >> A >> B;
	do {
		Extended_Euclid(A, B, X, Y);
		cout << X << " "<< Y << " " << A << "\n";
		cin >> A >> B;
	} while(cin.eof() == false);
	return 0;
}
